package com.huawei.java.model;

import java.util.HashMap;
import java.util.Map;

public class Demand {
    private String timestamp;

    private Map<String, Integer> demandMap = new HashMap<>();

    private boolean ninetyFiveThreshold;

    private boolean distributionSuccess;

    public String getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(String timestamp) {
        this.timestamp = timestamp;
    }

    public Map<String, Integer> getDemandMap() {
        return demandMap;
    }

    public void setDemandMap(Map<String, Integer> demandMap) {
        this.demandMap = demandMap;
    }

    public boolean isNinetyFiveThreshold() {
        return ninetyFiveThreshold;
    }

    public void setNinetyFiveThreshold(boolean ninetyFiveThreshold) {
        this.ninetyFiveThreshold = ninetyFiveThreshold;
    }

    public boolean isDistributionSuccess() {
        return distributionSuccess;
    }

    public void setDistributionSuccess(boolean distributionSuccess) {
        this.distributionSuccess = distributionSuccess;
    }

    @Override
    public String toString() {
        int totalDemand = demandMap.values().stream().mapToInt(Integer::intValue).sum();
        return "Demand{" +
                "timestamp='" + timestamp + '\'' +
                ", totalDemand=" + totalDemand +
                ", distributionSuccess" + distributionSuccess +
                '}';
    }
}
